//functon check box all in group function

function CheckAll(idgroup) {
	
	 var fmobj = document.adminForm;
	 var allboxid 	= document.getElementById('allbox' + idgroup);
	 
	 for (var i=0;i<fmobj.elements.length;i++){
	 	var e = fmobj.elements[i];	 		 	
	 	if ( (e.type=='checkbox')) {	 		
	 		var idc = e.id;
	 		idc = idc.split('_');
	 		if(idc[0] == idgroup && idc[1] == 'chkFunction')
	 			e.checked = allboxid.checked;
	 	}
	 }	
	 return true;
}
// Dom Sawap
function domSwap(fromList, toList) {
	// If nothing is selected then return
	var selIndex = fromList.selectedIndex;
	if(selIndex < 0) { return; }
	
	// Prepare variables
	var arrLookup   = new Array();  // To quickly find the index of the text
	var arrToList   = new Array();  // To use JavaScripts builtin sort
	var newToList   = toList.cloneNode(false);   // Only clone the parent
	
	// Decrement to keep the changing index from affecting the moves
	for(var i = fromList.length - 1; i >= 0; i--) {
	    arrLookup[fromList.options.item(i).text] = i;
	    if(fromList.options.item(i).selected) {
	        // Append to the toList unsorted initially
	        toList.appendChild(fromList.options.item(i));
	    }
	}
	
	// Prepare the sorting arrays
	for( var i = 0; i < toList.length; i++)  {
	    arrLookup[toList.options.item(i).text] = i;
	    arrToList[i] = toList.options.item(i).text;
	}
	arrToList.sort(); // <-- Where the action really occurs
	
	// Decrement to keep the index from being affected
	for( var i = arrToList.length - 1; i >= 0; i-- ) {
	    // Use insertBefore instead of appendChild because of decrementing.
	    newToList.insertBefore(toList.options.item(arrLookup[arrToList[i]]).cloneNode(true), newToList.options.item(0));
	}
	
	// Swap the unsorted node with the sorted one.
	toList.replaceNode(newToList);
	fromList.swapNode(fromList); // IE workaround
	
	// Deselect any selected options.
	fromList.selectedIndex  = -1;
	toList.selectedIndex    = -1;
}

function selectAllOptions(selStr)
{
  var selObj = document.getElementById(selStr);
  for (var i=0; i<selObj.options.length; i++) {
    selObj.options[i].selected = true;
  }
}
